

function popupFlowerWindow(target,targetID){
  
    $("#flowerAndEggBox").html('<form id="addOrDelFlowerForm" ><input type="hidden" id="'+target+'ID" name="'+target+'ID"/><input type="hidden" id="action" name="action"/><div class="popup1"><div class="popup_title">送鲜花</div><div id="closeWindow" class="popup_close"><a href="###"><span>关闭窗口</span></a></div> </div><div class="popup2"><div class="popup_content"></div><div class="popup_btns"><input type="button" class="btn_1" id="addOrDelFlowerBtn">&nbsp;<input type="button" class="btn_1" id="cancelFlowerBtn" value="取消"></div></div><div class="popup3"></div></form>');
  
 	$.ajax({
	         type: 'Get',
	         url: edp_domain_url + 'ajax_flower_egg/?type=flower&tiny=1',
	         dataType: 'json',	
			 data:{ target:target, targetID: targetID },
			 timeout: 5000,
			 global:false,
		     beforeSend: function(){
				$.blockUI({ 
				     message: '正在获取...',
			         css: { padding:'5px',color:'#CC0000'}});
			 },
			 error: function(){
				$.blockUI({ 
				     message: '获取出错...',
			         css: { padding:'5px',color:'#CC0000'}});
				$.unblockUI();
			 },
	         success: function(data){
				
				if(data.login){			                          
                     
                     popupLogin($("#flowerAndEggBox"),'送鲜花');       
                                               
				}else{
								
					if(data.add=='false'){
						 $(".popup_content").html('送朵鲜花支持一下吧!');				  
						 $("#addOrDelFlowerForm>input[name='action']").attr('value','addFlower');
						 $("#addOrDelFlowerBtn").attr('value','添加');
						 $("#addOrDelFlowerBtn").bind('click', {targetID: targetID}, AddFlower);
					     $("#"+target+"ID").attr('value',targetID);
					        
					 }else{
		                 $(".popup_content").html('您已送过鲜花!');
		                 $("#addOrDelFlowerForm>input[name='action']").attr('value','delFlower');
	                     $("#addOrDelFlowerBtn").attr('value','删除');
	                     $("#addOrDelFlowerBtn").bind('click', {targetID: targetID}, DelFlower);
	 					 $("#"+target+"ID").attr('value',targetID);					 
	                  }								
				}
					 
			     $.blockUI({ 
			           message: $('#flowerAndEggBox'),
			           css: { 
				        padding:        0,
				        margin:         0,
				        top:            '30%', 
        				left:           '35%', 
				        width:          '',
				        textAlign:      '', 
				        color:          '', 
				        border:         '',
				        backgroundColor:'',       				
				        cursor:         'wait'				        
   					 }}); 				  			 	 
	         }
	    });                          
   	   
	   function AddFlower(event) {
	       
	      var params = $("#addOrDelFlowerForm").serializeArray();
	   
	      $.ajax({
	                type: 'post',
	                url: edp_domain_url + 'ajax_flower_egg/?type=flower&tiny=2',
	                dataType: 'json',	
	                data: params,
					timeout: 5000,
					global:false,
		            beforeSend: function(){
					 $.blockUI({ 
					    message: '正在处理...',
		                css: { padding:'5px',color:'#CC0000'}});
					},
					error: function(){
					  $.blockUI({ 
					    message: '添加出错...',
		                css: { padding:'5px',color:'#CC0000'}});
					},
	                success: function(data){
	       	                    	
	                 if(data.res=='1'){
		                 var num= "span[id='Flower"+event.data.targetID+"']";
		                 	    
		                 if($(num).length==0){
		                 
							 $("a[id='Flower"+event.data.targetID+"']").after('<span id="Flower'+event.data.targetID+'" >(0)</span>');
		                 }
		                 
		                 var newnum = parseInt($(num).text().substring(1,$(num).text().length-1))+parseInt(1);            
		                 $(num).text('('+newnum+')');  
	                                                                               
						 $.blockUI({ 
						     message: '添加鲜花成功...',
			                 css: { padding:'5px',color:'#CC0000'}});
			           }else{
			         
			           		if(data.res=='0')			           					          
					           	$.blockUI({ 
								     message: '不能给自己创建的内容赠送鲜花...',
					                 css: { padding:'5px',color:'#CC0000'},fadeOut: 1000});
					        else
					           	$.blockUI({ 
								     message: '添加鲜花失败...',
					                 css: { padding:'5px',color:'#CC0000'},fadeOut: 1000});					        			           
			           }
			                     
	                },
	                complete: function(data){
	                
	                  $.unblockUI();
	                }
	            });
	   }
	
	   function DelFlower(event) {
	       
	      var params = $("#addOrDelFlowerForm").serializeArray();
	   
	      $.ajax({
	                type: 'post',
	                url: edp_domain_url + 'ajax_flower_egg/?type=flower&tiny=2',
	                dataType: 'json',
	                data: params,
					timeout: 5000,
					global:false,
		            beforeSend: function(){
					 $.blockUI({ 
					     message: '正在处理...',
		                 css: { padding:'5px',color:'#CC0000'}}); 
					},
					error: function(){
					  $.blockUI({ 
					     message: '删除出错...',
		                 css: { padding:'5px',color:'#CC0000'}}); 
					},
	                success: function(data){
	                	 if(data.res=='1'){
			                 var num= "span[id='Flower"+event.data.targetID+"']";
			                 var newnum = parseInt($(num).text().substring(1,$(num).text().length-1))-parseInt(1);
			                 $(num).text('('+newnum+')');                         
							 $.blockUI({ 
							     message: '删除鲜花成功...',
				                 css: { padding:'5px',color:'#CC0000'},fadeOut: 1000});   
			             } else{
			             	$.blockUI({ 
							     message: '删除鲜花失败...',
				                 css: { padding:'5px',color:'#CC0000'},fadeOut: 1000});   
			             
			             }            
	                },
	                complete: function(data){
	                
	                  $.unblockUI();
	                }
	            });
	   }   	   
   	   
	   $("#cancelFlowerBtn").click(function() {
	      $.unblockUI();
	   });  	
	   
	   $("#closeWindow>a").click(function() {
	      $.unblockUI();
	   });

	return false;
   	   	   		   		     
}



	  
function popupEggWindow(target,targetID){
  
	$("#flowerAndEggBox").html('<form id="addOrDelEggForm" ><input type="hidden" id="'+target+'ID" name="'+target+'ID"/><input type="hidden" id="action" name="action"/><div class="popup1"><div class="popup_title">扔鸡蛋</div><div id="closeWindow" class="popup_close"><a href="###"><span>关闭窗口</span></a></div> </div><div class="popup2"><div class="popup_content"></div><div class="popup_btns"><input type="button" class="btn_1" id="addOrDelEggBtn" value="添加">&nbsp;<input type="button" class="btn_1" id="cancelEggBtn" value="取消"></div></div><div class="popup3"></div></form>');
  
 	$.ajax({
	         type: 'Get',
	         url: edp_domain_url + 'ajax_flower_egg/?type=egg&tiny=1',
	         dataType: 'json',	
			 data:{ target:target, targetID: targetID },
			 timeout: 5000,
			 global:false,
		     beforeSend: function(){
				$.blockUI({ 
				     message: '正在获取...',
			         css: { padding:'5px',color:'#CC0000'}});
			 },
			 error: function(){
				$.blockUI({ 
				     message: '获取出错...',
			         css: { padding:'5px',color:'#CC0000'}});
				$.unblockUI();
			 },
	         success: function(data){
				
				if(data.login){			                          
                     
                     popupLogin($("#flowerAndEggBox"),'扔鸡蛋');       
                                               
				}else{
								
					if(data.add=='false'){
					
					     $(".popup_content").html('扔个鸡蛋踩一下!');				  
						 $("#addOrDelEggForm>input[name='action']").attr('value','addEgg');
						 $("#addOrDelEggBtn").attr('value','添加');
						 $("#addOrDelEggBtn").bind('click', {targetID: targetID}, AddEgg);
				         $("#"+target+"ID").attr('value',targetID);
				        
				     }else{
	                     $(".popup_content").html('您已扔过鸡蛋!');
	                     $("#addOrDelEggForm>input[name='action']").attr('value','delEgg');
                         $("#addOrDelEggBtn").attr('value','删除');
                         $("#addOrDelEggBtn").bind('click', {targetID: targetID}, DelEgg);
 						 $("#"+target+"ID").attr('value',targetID);
                     }						
				}
					 
			     $.blockUI({ 
			           message: $('#flowerAndEggBox'),
			           css: { 
				        padding:        0,
				        margin:         0,
				        top:            '30%', 
        				left:           '35%', 
				        width:          '',
				        textAlign:      '', 
				        color:          '', 
				        border:         '',
				        backgroundColor:'',       				
				        cursor:         'wait'				        
   					 }}); 				  			 	 
	         }
	    });                          

	   function AddEgg(event) {
	       
	      var params = $("#addOrDelEggForm").serializeArray();
	   
	      $.ajax({
	                type: 'post',
	                url: edp_domain_url + 'ajax_flower_egg/?type=egg&tiny=2',
	                dataType: 'json',	                
	                data: params,
					timeout: 5000,
					global:false,
		            beforeSend: function(){
					 $.blockUI({ message: '正在处理...' ,
		                css: { padding:'5px',color:'#CC0000'}});
					},
					error: function(){
					  $.blockUI({ message: '投掷出错...',
		                css: { padding:'5px',color:'#CC0000'}});
					},
	                success: function(data){
	                  
	                  if(data.res=='1'){
	                  
		                 var num= "span[id='Egg"+event.data.targetID+"']";
		                 
		                 if($(num).length==0){
		                 
							 $("a[id='Egg"+event.data.targetID+"']").after('<span id="Egg'+event.data.targetID+'" >(0)</span>');
		                 }	                 
		                 
		                 var newnum = parseInt($(num).text().substring(1,$(num).text().length-1))+parseInt(1);            
		                 $(num).text('('+newnum+')');                                                               
						 $.blockUI({ message: '投掷鸡蛋成功...',
			                css: { padding:'5px',color:'#CC0000'}});   
			                
			           }else{
			           		 if(data.res=='0')
					           	 $.blockUI({ message: '不能对自己创建的内容扔鸡蛋...',
					                css: { padding:'5px',color:'#CC0000'},fadeOut: 1000});   
			           		 if(data.res=='-1')
					           	 $.blockUI({ message: '您在该用户的黑名单中,无法对其扔鸡蛋...',
					                css: { padding:'5px',color:'#CC0000'},fadeOut: 1000});  
			           		 if(data.res=='-2')
					           	 $.blockUI({ message: '投掷出错...',
					                css: { padding:'5px',color:'#CC0000'},fadeOut: 1000});  					                					                
			           }            
	                },
	                complete: function(data){
	                
	                  $.unblockUI();
	                }
	            });
	   }
	
	   function DelEgg(event) {
	       
	      var params = $("#addOrDelEggForm").serializeArray();
	   
	      $.ajax({
	                type: 'post',
	                url: edp_domain_url + 'ajax_flower_egg/?type=egg&tiny=2',
	                dataType: 'json',	                
	                data: params,
					timeout: 5000,
					global:false,
		            beforeSend: function(){
					 $.blockUI({ message: '正在处理...' ,
		                css: { padding:'5px',color:'#CC0000'}});
					},
					error: function(){
					  $.blockUI({ message: '删除出错...' ,
		                css: { padding:'5px',color:'#CC0000'}});
					},
	                success: function(data){
	                 
	                  if(data.res=='1'){
		                 var num= "span[id='Egg"+event.data.targetID+"']";
		                 var newnum = parseInt($(num).text().substring(1,$(num).text().length-1))-parseInt(1);
		                 $(num).text('('+newnum+')');                         
						 $.blockUI({ message: '删除鸡蛋成功...' ,
			                css: { padding:'5px',color:'#CC0000'},fadeOut: 1000});     
		               }else{
			           	 $.blockUI({ message: '删除出错...',
			                css: { padding:'5px',color:'#CC0000'},fadeOut: 1000});   
			           }     
		                     
	                },
	                complete: function(data){
	                
	                  $.unblockUI();
	                }
	            });
	   }
  
	   $("#cancelEggBtn").click(function() {
	      $.unblockUI();
	   }); 
	   
	   $("#closeWindow>a").click(function() {
	      $.unblockUI();
	   });
	return false;
}
